/**
 * 功能描述
 */
define(function (require, exports, module) {
	var Component = require("subnav");
	var proctrgrid = require("../constant/fetchProperties");
	var user = require("store").get("user");

	
    var instance = {
        initComponent: function (params, widget) {
            var subnav = new Component({
            	parentNode:".J-subnav",
				model : {
					title:"返券",
					items : [{
        				id:"search",
        				type:"search",
        				placeholder:"会员/卡号/证件号",
        				handler:function(str){
        					var grid=widget.get("grid");
        					aw.ajax({
        						url:"api/welfareconsumptioncoupon/search*",
        						data:{
        							s:str,
        							properties:"travelContract.member.personalInfo.name,cardNo,travelContract.member.personalInfo.idNumber",
        							"status":"Effective",
        							"servicePoint.pkServicePoint" : subnav.getValue("servicePoint"),
        							fetchProperties:proctrgrid.fetchProperties
        						},
        						dataType:"json",
        						success:function(data){
        							grid.setData(data);
        						}
        					});
        				}
        			},{
        				id:"servicePoint",
        				type:"buttongroup",
//        				lazy: true,
        				tip:"服务点",
        				keyField :"pkServicePoint",
					    valueField : "name",
					    items:user.privateServicePoints,
//					    url : "api/servicepoint/operableservicepoints",
					    handler : function(key,element){
					    	widget.get("grid").refresh();
					    }
        			}]
				}
            });
            widget.set("subnav", subnav);
        }
    };
    module.exports = instance;
});
